<template>
	<view class="homelifeis">
		<view class="font-323232 font16 font-b">{{dataobj.name}}</view>
		<view class="homelifeis_box">
			<view>{{dataobj.createtime}}</view>
		</view>
		<video v-if="dataobj.is_video==1" class="img" :src="dataobj.video_url" :poster="dataobj.img"></video>
		<image v-if="dataobj.is_video!=1" class="img" :src="dataobj.img" mode=""></image>
		<view class="homelifeis_rich_text">
			<rich-text :nodes="dataobj.content"></rich-text>
		</view>
		<image @click="Onenlarge" class="images" :src="dataobj.images" mode=""></image>
	</view>
</template>

<script>
	export default {
		onLoad: function(options) {
			this.id = options.id
			this.type = options.type
			//获取详情
			this.OnArticleinfo()
		},
		data() {
			return {
				id:null,
				table:'',
				Articleinfobj: '',
				dataobj:{},//返回数据
			}
		},
		methods: {
			///获取详情
			OnArticleinfo() {
				this.$Http({
					url: 'contentDetails',
					data: {
						id:this.id,
						table:this.type
					}
				}).then(res => {
					res.data.images = this.$store.state.http_img + res.data.images
					res.data.img = this.$store.state.http_img + res.data.img
					if(res.data.is_video==1){
						res.data.video_url=this.$store.state.http_img + res.data.video_url
					}
					res.data.createtime = this.$base.formatTime(new Date(res.data.createtime *
								1000), "yyyy/MM/dd hh:mm:ss")
					res.data.content = res.data.content?res.data.content.replace(/\<img/g,'<img style="display: block;max-width: 100%;height: auto;"'):''
					this.dataobj = res.data
				})
			},
			//图片放大
			Onenlarge() {
				let list = [this.dataobj.images]
				uni.previewImage({
					current: 1, // 当前显示图片的http链接
					urls: list // 需要预览的图片http链接列表
				})
			},
		}
	}
</script>

<style>
	.homelifeis {
		width: 750rpx;
		padding: 50rpx 30rpx;
	}

	.homelifeis_box {
		width: 690rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 26rpx;
		color: #969696;
		margin: 45rpx 0;
	}

	.rich-img {
		width: 690rpx !important;
	}

	.homelifeis_rich_text {
		width: 690rpx;
		font-size: 28rpx;
		color: #323232;
	}

	.images{
		width: 500rpx;
		height: 500rpx;
		margin: 30rpx 95rpx 0 95rpx;
	}

	.img{
		width: 690rpx;
		height: 300rpx;
		margin-bottom: 20rpx;
	}
</style>
